<!-- 员工管理 -->
<template>
    <div id="person">
        <!--<el-row >  默认占满屏 一用就把左边的覆盖了，不知道为什么 -->
        <!-- 搜索的时候按照 工厂、部门、员工号、 -->
        <div style="width: 100%;height: 85px;background-color: #FAFAFA;padding-top: 1%;">
            <!-- 工号 -->
            <el-col :xs="2" :sm="2" :md="2" :lg="2" style="margin:0 0 0 0.5%">
                <el-input placeholder="工号" v-model="UserCode"></el-input>
            </el-col>
            <!-- 姓名 -->
            <el-col :xs="2" :sm="2" :md="2" :lg="2" style="margin: 0 0.5%">
                <el-input placeholder="姓名" v-model="UserName"></el-input>
            </el-col>
            <!-- 工厂 -->
            <el-col :xs="2" :sm="2" :md="2" :lg="2">
                <el-select @change="GetDepart" v-model="valueFactory" clearable placeholder="隶属工厂">
                    <el-option v-for="item in FactoryOptions" :key="item.ID" :label="item.FactoryName" :value="item.ID"></el-option>
                </el-select>
            </el-col>
            <!-- 部门 -->
            <el-col :xs="2" :sm="2" :md="2" :lg="2" style="margin: 0 0.5%">
                <el-select @change="GetOffice"  v-model="valueDepart" clearable placeholder="隶属部门">
                    <el-option v-for="item in DepartOptions" :key="item.DepartmentCode" :label="item.DepartmentName" :value="item.DepartmentCode"></el-option>
                </el-select>
            </el-col>
            <!-- 科室 -->
            <el-col :xs="2" :sm="2" :md="2" :lg="2" style="margin:0 0.5% 0 0">
                <el-select  v-model="valueOffice" clearable placeholder="隶属科室">
                    <el-option v-for="item in OfficeOptions" :key="item.OfficeCode" :label="item.OfficeName" :value="item.OfficeCode"></el-option>
                </el-select>
            </el-col>
            <!-- 职务状态 -->
            <el-col :xs="2" :sm="2" :md="2" :lg="2" style="margin:0">
                <el-select v-model="UserStatus" clearable filterable placeholder="在职 / 离职">
                    <el-option label="在职" value="1"></el-option>
                    <el-option label="离职" value="2"></el-option>
                    <el-option label="试用期" value="3"></el-option>
                    <el-option label="停薪留职" value="4"></el-option>
                </el-select>
            </el-col>
            <!-- 日期选择 -->
            <el-col :xs="3" :sm="3" :md="3" :lg="3" style="margin: 0 0.5% 0 0">
                <el-date-picker
                        v-model="DateTimeStr"
                        type="daterange"
                        placeholder="选择日期范围">
                </el-date-picker>
            </el-col>
            <el-col :xs="5" :sm="5" :md="5" :lg="5" style="text-align: left;">
                <el-button type="primary" @click="selectTable">查询</el-button>
                <el-button type="success" @click="add">新增人员</el-button>
            </el-col>
        </div>
        <!-- max-height 600时就固定表头，显示滚动条  show-overflow-tooltip 表格内容多了可以显示一个提示框显示剩余内容   sortable排序 -->
        <el-table ref="Table"  max-height="600" class="table_person" stripe border :data="tableData" tooltip-effect="dark"
                   style="width: 88%;text-align: center !important;">
            <el-table-column prop="index" sortable width="60"></el-table-column>
            <el-table-column prop="UserCode" sortable label="员工代号11" if="false"></el-table-column>
            <el-table-column prop="UserName" label="姓名"></el-table-column>
            <el-table-column prop="Sex" sortable label="性别11" v-if="false"></el-table-column>
            <el-table-column prop="DateOfBirth" sortable label="出生年月"></el-table-column>
            <el-table-column prop="FactoryID" sortable label="工厂ID" v-if="false"></el-table-column>
            <el-table-column prop="FactoryName" sortable label="工厂" v-if="false"></el-table-column>
            <el-table-column prop="DepartCode" sortable label="部门ID" v-if="false"></el-table-column>
            <el-table-column prop="DepartmentName" sortable label="部门"></el-table-column>
            <el-table-column prop="OfficeCode" sortable label="科室ID" v-if="false"></el-table-column>
            <el-table-column prop="OfficeName" sortable label="科室"></el-table-column>
            <el-table-column prop="RankDutyID" sortable label="职务职级ID11"></el-table-column>
            <el-table-column prop="RankDuty" sortable label="职务职级"></el-table-column>
            <el-table-column prop="WorkYear" sortable label="工龄"></el-table-column>
            <el-table-column prop="EntryDate" sortable label="入职时间"></el-table-column>
            <el-table-column prop="LeaveDate" sortable label="离职时间"></el-table-column>
            <el-table-column prop="EnteryMode" sortable label="入职方式"></el-table-column>
            <el-table-column prop="IdentityCard" label="身份证号" v-if="false"></el-table-column>
            <el-table-column prop="ContactWay" label="联系方式11" v-if="false"></el-table-column>
            <el-table-column prop="NativePlace" label="籍贯" v-if="false"></el-table-column>
            <el-table-column prop="HomeAddress" label="家庭住址" v-if="false"></el-table-column>
            <el-table-column prop="Marry" sortable label="婚否11"></el-table-column>
            <el-table-column prop="Educational" label="学历" v-if="false"></el-table-column>
            <el-table-column prop="CriticalContactWay" label="紧急电话" v-if="false"></el-table-column>
            <el-table-column prop="UserStatus" sortable label="状态"></el-table-column>
            <el-table-column prop="AwardPunish" label="奖惩历史" v-if="false"></el-table-column>
            <el-table-column prop="WageSettlementMode" sortable label="工资结算方式" ></el-table-column>
            <el-table-column prop="BasicWage" sortable label="基本工资11"></el-table-column>
            <el-table-column prop="AchievementBonus" sortable label="绩效奖金11"></el-table-column>
            <el-table-column prop="PostAllowance" sortable label="岗位津贴11"></el-table-column>
            <el-table-column prop="PerfectAttendance" sortable label="全勤奖11"></el-table-column>
            <el-table-column prop="PhotoImg" label="照片" v-if="false"></el-table-column>
            <el-table-column prop="CartificageImg" label="证书" v-if="false"></el-table-column>
            <el-table-column prop="IdentityImg" label="身份证复印件" v-if="false"></el-table-column>
            <!-- 操作者 -->
            <el-table-column prop="OpeartionUseID" label="操作人员工号" v-if="false"></el-table-column>
            <el-table-column prop="OpeartionUseName" label="操作人员" v-if="false"></el-table-column>
            <el-table-column prop="ModifyDate" sortable label="时间" v-if="false"></el-table-column>
            <el-table-column label="授权" v-if="false">
                <template scope="scope">
                    <el-button size="small" type="success"
                               @click="handleEmpower(scope.$index, scope.row)">授权</el-button>
                </template>
            </el-table-column>
             <!--修改和删除 -->
            <el-table-column label="操作" fixed="right">
                <template scope="scope">
                    <el-button size="small"
                               @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
                    <el-button size="small" type="danger"
                               @click="handleDelete(scope.$index, scope.row)">删除</el-button>
                </template>
            </el-table-column>
        </el-table>
         <!--分页 -->
        <div class="block" style="text-align: right;padding: 4% 1% 0 0">       <!-- , jumper 加到layout里面 前往第 几 页     -->
            <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :page-size="PageCount" :page-sizes="[10, 20, 30, 40,50]"
                           :current-page="CurrentPage"  layout="total,sizes, prev, pager, next" :total="Total"></el-pagination>
        </div>
        <!-- 新增人员 -->
        <el-dialog title="新增人员" :visible.sync="addFormVisible">
            <el-form :model="form" style="text-align: left;width: 90%;margin:auto">
                <!--工号-->
                <el-form-item label="工号" :label-width="formLabelWidth">
                    <el-input v-model="form.UserCode" auto-complete="off" style="width: 50%"></el-input>
                </el-form-item>
                <!-- 姓名 -->
                <el-form-item label="姓名" :label-width="formLabelWidth">
                    <el-input v-model="form.UserName" auto-complete="off" style="width: 50%"></el-input>
                </el-form-item>
                <!-- 性别 -->
                <el-form-item label="性别" :label-width="formLabelWidth">
                    <el-select v-model="form.Sex" clearable placeholder="请选择" >
                        <el-option label="男" value="1"></el-option>
                        <el-option label="女" value="2"></el-option>
                        <el-option label="其他" value="0"></el-option>
                    </el-select>
                </el-form-item>
                <!-- 选择工厂的时候就应该把部门拿到 -->
                <el-form-item label="工厂" :label-width="formLabelWidth">
                    <el-select @change="selectParentAdd" v-model="valueFactoryAdd" clearable placeholder="请选择">
                        <el-option  v-for="item in FactoryOptionsAdd" :key="item.ID" :label="item.FactoryName" :value="item.ID"></el-option>
                    </el-select>
                </el-form-item>
                <!-- 部门 -->
                <el-form-item label="部门" :label-width="formLabelWidth">
                    <el-select @change="GetOfficeDuty" v-model="valueParentAdd" clearable placeholder="请选择">
                        <el-option v-for="item in ParentOptionsAdd" :key="item.DepartmentCode" :label="item.DepartmentName" :value="item.DepartmentCode"></el-option>
                    </el-select>
                </el-form-item>
                <!-- 科室 >>>》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》 -->
                <el-form-item label="科室" :label-width="formLabelWidth">
                    <el-select v-model="OfficeAdd" clearable placeholder="请选择">
                        <el-option v-for="item in OfficeOptionsAdd" :key="item.OfficeCode" :label="item.OfficeName" :value="item.OfficeCode"></el-option>
                    </el-select>
                </el-form-item>
                <!--  职务 职级 下拉框  》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》。。 -->
                <el-form-item label="职务职级" :label-width="formLabelWidth">
                    <el-select @change="GetSalary" v-model="DutyAdd" clearable placeholder="请选择">
                        <el-option  v-for="item in DutyOptionsAdd" :key="item.ID" :label="item.RankDuty" :value="item.ID"></el-option>
                    </el-select>
                </el-form-item>
                <!-- 入职方式 -->
                <el-form-item label="入职方式" :label-width="formLabelWidth">
                    <el-select v-model="form.EnteryMode" clearable placeholder="请选择">
                        <el-option label="网上" value="1"></el-option>
                        <el-option label="招聘会" value="2"></el-option>
                        <el-option label="其他" value="0"></el-option>
                    </el-select>
                </el-form-item>
                <!-- 职务状态 -->
                <el-form-item label="职务状态" :label-width="formLabelWidth">
                    <el-select v-model="form.UserStatus" clearable placeholder="请选择">
                        <el-option label="在职" value="1"></el-option>
                        <el-option label="离职" value="2"></el-option>
                        <el-option label="试用期" value="3"></el-option>
                        <el-option label="停薪留职" value="4"></el-option>
                    </el-select>
                </el-form-item>
                <!-- 入职时间 -->
                <el-form-item label="入职时间" :label-width="formLabelWidth">
                    <div class="block">
                        <el-date-picker
                                v-model="form.EntryDate"
                                type="date"
                                placeholder="选择日期" >
                        </el-date-picker>
                    </div>
                </el-form-item>
                <!-- 离职时间 -->
                <el-form-item label="离职时间" :label-width="formLabelWidth">
                    <div class="block">
                        <el-date-picker
                                v-model="form.LeaveDate"
                                type="date"
                                placeholder="选择日期" >
                        </el-date-picker>
                    </div>
                </el-form-item>
                <!--出生年月-->
                <el-form-item label="出生年月" :label-width="formLabelWidth">
                    <div class="block">
                        <el-date-picker
                                v-model="form.DateOfBirth"
                                type="date"
                                placeholder="选择日期" >
                        </el-date-picker>
                    </div>
                </el-form-item>
                <!--婚姻状况-->
                <el-form-item label="婚姻状况" :label-width="formLabelWidth">
                    <el-select v-model="form.Marry" clearable placeholder="请选择" >
                        <el-option label="未婚" value="2"></el-option>
                        <el-option label="已婚" value="1"></el-option>
                        <el-option label="其他" value="3"></el-option>
                    </el-select>
                </el-form-item>
                <!--联系方式-->
                <el-form-item label="联系方式" :label-width="formLabelWidth">
                    <el-input v-model="form.ContactWay" auto-complete="off" style="width: 80%"></el-input>
                </el-form-item>
                <!--身份证号-->
                <el-form-item label="身份证号" :label-width="formLabelWidth">
                    <el-input v-model="form.IdentityCard" auto-complete="off" style="width: 80%"></el-input>
                </el-form-item>
                <!--家庭住址-->
                <el-form-item label="家庭住址" :label-width="formLabelWidth">
                    <el-input v-model="form.HomeAddress" auto-complete="off" style="width: 80%"></el-input>
                </el-form-item>
                <!--籍贯-->
                <el-form-item label="籍贯" :label-width="formLabelWidth">
                    <el-input v-model="form.NativePlace" auto-complete="off" style="width: 80%"></el-input>
                </el-form-item>
                <!--学历-->
                <el-form-item label="学历" :label-width="formLabelWidth">
                    <el-input v-model="form.Educational" auto-complete="off" style="width: 80%"></el-input>
                </el-form-item>
                <!--工资结算-->
                <el-form-item label="工资结算" :label-width="formLabelWidth">
                    <el-select v-model="form.WageSettlementMode" clearable placeholder="请选择">
                        <el-option label="固定" value="1"></el-option>
                        <el-option label="计件" value="2"></el-option>
                        <el-option label="计时" value="3"></el-option>
                        <el-option label="其他" value="0"></el-option>
                    </el-select>
                </el-form-item>
                <!--基本工资-->
                <el-form-item label="基本工资" :label-width="formLabelWidth">
                    <div style="display: flex;">
                        <div style="flex: 6;">
                            <!-- 实际 -->
                            <el-input v-model="form.BasicWage" auto-complete="off" style="width: 90%"></el-input>
                        </div>
                        <div style="flex: 3;">
                            <!-- 最小 -->
                            <el-input v-model="Salary.BasicWageMin" :disabled="true" auto-complete="off" style="width: 100%"></el-input>
                        </div>
                        <div style="flex: 1;text-align: center">
                           ——
                        </div>
                        <div style="flex: 3;">
                            <!-- 最大 -->
                            <el-input v-model="Salary.BasicWageMax" :disabled="true" auto-complete="off" style="width: 100%"></el-input>
                        </div>
                        <div style="flex: 3;"></div>
                    </div>
                </el-form-item>
                <!--绩效奖金-->
                <el-form-item label="绩效奖金" :label-width="formLabelWidth">
                    <el-input v-model="Salary.AchievementBonus" auto-complete="off" style="width: 50%"></el-input>
                </el-form-item>
                <!--岗位津贴-->
                <el-form-item label="岗位津贴" :label-width="formLabelWidth">
                    <el-input v-model="Salary.PostAllowance" auto-complete="off" style="width: 50%"></el-input>
                </el-form-item>
                <!--岗位津贴-->
                <el-form-item label="全勤奖" :label-width="formLabelWidth">
                    <el-input v-model="Salary.PerfectAttendance" auto-complete="off" style="width: 50%"></el-input>
                </el-form-item>
                <!-- 紧急电话 -->
                <el-form-item label="紧急电话" :label-width="formLabelWidth">
                    <el-input v-model="form.CriticalContactWay" auto-complete="off" style="width: 80%"></el-input>
                </el-form-item>
                <!-- 奖惩历史 -->
                <el-form-item label="奖惩历史" :label-width="formLabelWidth">
                    <el-input v-model="form.AwardPunish" auto-complete="off" style="width: 80%"></el-input>
                </el-form-item>
                <!-- 上传 -->
                <el-form-item label="照片" :label-width="formLabelWidth">
                    <label v-model="form.PhotoImg" ></label>
                    <el-button>上传两寸照片</el-button>
                    <!--<el-input v-model="form.PhotoImg" auto-complete="off" style="width: 80%"></el-input>-->
                </el-form-item>
                <el-form-item label="证书复印件" :label-width="formLabelWidth">
                    <label v-model="form.CartificageImg" ></label>
                    <el-button>证书复印件</el-button>
                    <!--<el-input v-model="form.CartificageImg" auto-complete="off" style="width: 80%"></el-input>-->
                </el-form-item>
                <el-form-item label="身份证复印件" :label-width="formLabelWidth">
                    <label v-model="form.IdentityImg" ></label>
                    <el-button>身份证复印件</el-button>
                    <!--<el-input v-model="form.IdentityImg" auto-complete="off" style="width: 80%"></el-input>-->
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="addFormVisible = false">取 消</el-button>
                <el-button type="primary" @click="addForm">确 定</el-button>
            </div>
        </el-dialog>
        <!-- 修改人员 -->
        <el-dialog title="修改人员" :visible.sync="EditFormVisible">
            <el-form :model="formEdit" style="text-align: left;width:90%;margin: auto">
                <!--工号-->
                <el-form-item label="工号" :label-width="formLabelWidth">
                    <el-input v-model="formEdit.UserCode" auto-complete="off" style="width: 50%"></el-input>
                </el-form-item>
                <!-- 姓名 -->
                <el-form-item label="姓名" :label-width="formLabelWidth">
                    <el-input v-model="formEdit.UserName" auto-complete="off" style="width: 50%"></el-input>
                </el-form-item>
                <!-- 性别 -->
                <el-form-item label="性别" :label-width="formLabelWidth">
                    <el-select v-model="formEdit.Sex" clearable placeholder="请选择" >
                        <el-option label="男" value="男"></el-option>
                        <el-option label="女" value="女"></el-option>
                        <el-option label="其他" value="其他"></el-option>
                    </el-select>
                </el-form-item>
                <!-- 选择工厂  》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》 -->
                <el-form-item label="工厂" :label-width="formLabelWidth">
                    <el-select @change="selectParentEdit" v-model="formEdit.FactoryID" clearable placeholder="请选择">
                        <el-option  v-for="item in EditFactoryOptions" :key="item.ID" :label="item.FactoryName" :value="item.ID"></el-option>
                    </el-select>
                </el-form-item>
                <!-- 部门 -->
                <el-form-item label="部门" :label-width="formLabelWidth">
                    <el-select @change="GetOfficeDutyEdit" v-model="formEdit.DepartCode" clearable placeholder="请选择">
                        <el-option v-for="item in EditParentOptions" :key="item.DepartmentCode" :label="item.DepartmentName" :value="item.DepartmentCode"></el-option>
                    </el-select>
                </el-form-item>
                <!-- 科室  -->
                <el-form-item label="科室" :label-width="formLabelWidth">
                    <el-select v-model="formEdit.OfficeCode" clearable placeholder="请选择">
                        <el-option v-for="item in EditOfficeOptions" :key="item.OfficeCode" :label="item.OfficeName" :value="item.OfficeCode"></el-option>
                    </el-select>
                </el-form-item>
                <!--  职务 职级 下拉框  》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》。。 -->
                <el-form-item label="职务职级" :label-width="formLabelWidth">
                    <el-select @change="GetSalaryEdit" v-model="formEdit.RankDutyID" clearable placeholder="请选择">
                        <el-option  v-for="item in EditDutyOptions" :key="item.ID" :label="item.RankDuty" :value="item.ID"></el-option>
                    </el-select>
                </el-form-item>
                <!-- 入职方式 -->
                <el-form-item label="入职方式" :label-width="formLabelWidth">
                    <el-select v-model="formEdit.EnteryMode" clearable placeholder="请选择">
                        <el-option label="网上" value="网上"></el-option>
                        <el-option label="招聘会" value="招聘会"></el-option>
                        <el-option label="其他" value="其他"></el-option>
                    </el-select>
                </el-form-item>
                <!-- ？？？？？？？？？？？？？？？？？？？？？？？？？？？？？？？？？？？？？？ -->
                <div style="display: flex">
                    <div style="flex: 1;">
                        <!-- 职务状态 -->
                        <el-form-item label="职务状态" :label-width="formLabelWidth">
                            <el-select v-model="formEdit.UserStatus" clearable placeholder="请选择">
                                <el-option label="在职" value="在职"></el-option>
                                <el-option label="离职" value="离职"></el-option>
                                <el-option label="试用期" value="试用期"></el-option>
                                <el-option label="停薪留职" value="停薪留职"></el-option>
                            </el-select>
                        </el-form-item>
                    </div>
                    <div style="flex: 1;">
                        <!-- 离职时间 -->
                        <el-form-item label="离职时间" :label-width="formLabelWidth">
                            <div class="block">
                                <el-date-picker
                                        v-model="formEdit.LeaveDate"
                                        type="date"
                                        format="yyyy-MM-dd"
                                        placeholder="选择日期" >
                                </el-date-picker>
                            </div>
                        </el-form-item>
                    </div>
                </div>
                <!-- 入职时间 -->
                <el-form-item label="入职时间" :label-width="formLabelWidth">
                    <div class="block">
                        <el-date-picker
                                v-model="formEdit.EntryDate"
                                type="date"
                                format="yyyy-MM-dd"
                                placeholder="选择日期" >
                        </el-date-picker>
                    </div>
                </el-form-item>

                <!--出生年月-->
                <el-form-item label="出生年月" :label-width="formLabelWidth">
                    <div class="block">
                        <el-date-picker
                                v-model="formEdit.DateOfBirth"
                                type="date"
                                format="yyyy-MM-dd"
                                placeholder="选择日期" >
                        </el-date-picker>
                    </div>
                </el-form-item>
                <!--婚姻状况-->
                <el-form-item label="婚姻状况" :label-width="formLabelWidth">
                    <el-select v-model="formEdit.Marry" clearable placeholder="请选择" >
                        <el-option label="未婚" value="未婚"></el-option>
                        <el-option label="已婚" value="已婚"></el-option>
                        <el-option label="其他" value="其他"></el-option>
                    </el-select>
                </el-form-item>
                <!--联系方式-->
                <el-form-item label="联系方式" :label-width="formLabelWidth">
                    <el-input v-model="formEdit.ContactWay" auto-complete="off" style="width: 80%"></el-input>
                </el-form-item>
                <!--身份证号-->
                <el-form-item label="身份证号" :label-width="formLabelWidth">
                    <el-input v-model="formEdit.IdentityCard" auto-complete="off" style="width: 80%"></el-input>
                </el-form-item>
                <!--家庭住址-->
                <el-form-item label="家庭住址" :label-width="formLabelWidth">
                    <el-input v-model="formEdit.HomeAddress" auto-complete="off" style="width: 80%"></el-input>
                </el-form-item>
                <!--籍贯-->
                <el-form-item label="籍贯" :label-width="formLabelWidth">
                    <el-input v-model="formEdit.NativePlace" auto-complete="off" style="width: 80%"></el-input>
                </el-form-item>
                <!--学历-->
                <el-form-item label="学历" :label-width="formLabelWidth">
                    <el-input v-model="formEdit.Educational" auto-complete="off" style="width: 80%"></el-input>
                </el-form-item>
                <!--工资结算-->
                <el-form-item label="工资结算" :label-width="formLabelWidth">
                    <el-select v-model="formEdit.WageSettlementMode" clearable placeholder="请选择">
                        <el-option label="固定" value="固定"></el-option>
                        <el-option label="计件" value="计件"></el-option>
                        <el-option label="计时" value="计时"></el-option>
                        <el-option label="其他" value="其他"></el-option>
                    </el-select>
                </el-form-item>
                <!--基本工资-->
                <el-form-item label="基本工资" :label-width="formLabelWidth">
                    <div style="display: flex;">
                        <div style="flex: 6;">
                            <!-- 实际 -->
                            <el-input v-model="formEdit.BasicWage" auto-complete="off" style="width: 90%"></el-input>
                        </div>
                        <div style="flex: 3;">
                            <!-- 最小 -->
                            <el-input v-model="formEdit.BasicWageMin" :disabled="true" auto-complete="off" style="width: 100%"></el-input>
                        </div>
                        <div style="flex: 1;text-align: center">
                            ——
                        </div>
                        <div style="flex: 3;">
                            <!-- 最大 -->
                            <el-input v-model="formEdit.BasicWageMax" :disabled="true" auto-complete="off" style="width: 100%"></el-input>
                        </div>
                        <div style="flex: 3;"></div>
                    </div>
                </el-form-item>
                <!--绩效奖金-->
                <el-form-item label="绩效奖金" :label-width="formLabelWidth">
                    <el-input v-model="formEdit.AchievementBonus" auto-complete="off" style="width: 50%"></el-input>
                </el-form-item>
                <!--岗位津贴-->
                <el-form-item label="岗位津贴" :label-width="formLabelWidth">
                    <el-input v-model="formEdit.PostAllowance" auto-complete="off" style="width: 50%"></el-input>
                </el-form-item>
                <!--岗位津贴-->
                <el-form-item label="全勤奖" :label-width="formLabelWidth">
                    <el-input v-model="formEdit.PerfectAttendance" auto-complete="off" style="width: 50%"></el-input>
                </el-form-item>
                <!-- 紧急电话 -->
                <el-form-item label="紧急电话" :label-width="formLabelWidth">
                    <el-input v-model="formEdit.CriticalContactWay" auto-complete="off" style="width: 80%"></el-input>
                </el-form-item>
                <!-- 奖惩历史 -->
                <el-form-item label="奖惩历史" :label-width="formLabelWidth">
                    <el-input v-model="formEdit.AwardPunish" auto-complete="off" style="width: 80%"></el-input>
                </el-form-item>
                <el-form-item label="照片" :label-width="formLabelWidthEdit">
                    <span></span>
                    <el-button>修改</el-button>
                </el-form-item>
                <el-form-item label="证书" :label-width="formLabelWidthEdit">
                    <span></span>
                    <el-button>修改</el-button>
                </el-form-item>
                <el-form-item label="身份证复印件" :label-width="formLabelWidthEdit">
                    <span></span>
                    <el-button>修改</el-button>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="EditFormVisible = false">取 消</el-button>
                <el-button type="primary" @click="EditForm">提 交</el-button>
            </div>
        </el-dialog>
        <!-- 删除人员 -->
        <el-dialog title="删除人员" :visible.sync="DeleteFormVisible">
            <el-form :model="formDelete">
                <el-form-item style="font-size: 18px;">
                    确定删除此人员吗？
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="DeleteFormVisible = false">取 消</el-button>
                <el-button type="danger" @click="DeleteForm" >确定</el-button>
            </div>
        </el-dialog>
        <!-- 授权 -->
        <el-dialog title="授权" :visible.sync="PowerFormVisible">
            <el-form :model="formPower" style="margin:auto;background-color: aqua;width: 80%">
                <el-form-item style="font-size: 18px;">
                    <el-table selectable="funCheck"
                               :data="PowerTable"
                               @selection-change="handleSelectionChange"
                               max-height="600" class="table_person" stripe border ref="multipleTable"  tooltip-effect="dark"
                               style="width: 100%;text-align: center !important;">
                        <el-table-column prop="" type="selection"></el-table-column>
                        <!--<el-table-column prop="index" label="序号"></el-table-column>-->
                        <el-table-column prop="RoleCode" sortable label="角色代号"></el-table-column>
                        <el-table-column prop="RoleName" label="角色名称"></el-table-column>
                        <el-table-column prop="RoleDescribe" sortable label="角色描述"></el-table-column>
                        <el-table-column prop="ModifyDate" sortable label="修改日期" v-if="false"></el-table-column>
                    </el-table>
                    <!--<el-button @click="toggleSelection([PowerTable[1]])">切换第二的选中状态</el-button>-->
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="PowerFormVisible = false">取 消</el-button>
                <el-button type="danger" @click="PowerForm" >确定</el-button>
            </div>
        </el-dialog>
    </div>
</template>

<script type="text/ecmascript-6">
    export default{
        data(){
            return{
                //  日期选择
                DateTimeStr:'',
                //    表格
                Table:[],
                tableData:[],
                UserCode:'',  //  根据名字、工厂号、部门号
                UserName:'',
                UserStatus:'',
                FactoryID:0,
                DepartCode:0 ,
                OfficeCode:0 ,
                //     分页
                PageCount:10,    // 每页几条   page-size
                CurrentPage:1,   // 当前是第几页
                Total:0,         // 总数
                //   工厂和部门的下拉框加载
                //  工厂
                FactoryOptions:[],    //  工厂   一加载页面就出现工厂的下拉框
                valueFactory:'',    //  选择的是哪个工厂号
                //  部门
                DepartOptions:[],    //  工厂   一选择工厂就确定有哪些部门
                valueDepart:'',    //  选择的是哪个部门
                //  科室
                OfficeOptions:[],    //  工厂   一选择部门就确定有哪些科室
                valueOffice:'',    //  选择的是哪个科室
                //  新增 工厂和部门的下拉框加载
                FactoryOptionsAdd:[],    //  工厂   一加载页面就出现工厂的下拉框
                valueFactoryAdd:'',    //  选择的是哪个工厂号
                ParentOptionsAdd:[],     // 部门
                valueParentAdd:'',     //  选择的是哪个部门ID
                OfficeOptionsAdd:[],     // 科室
                OfficeAdd:'',     //  选择的是哪个科室
                DutyOptionsAdd:[],     // 职务职级
                DutyAdd:null,     //  选择的是哪个职务职级
                Salary:{
                    //  工资
                    BasicWageMin:0 ,
                    BasicWageMax:0 ,
                    AchievementBonus:0 ,
                    PostAllowance:0 ,
                    PerfectAttendance: 0 ,
                },
                //  日期处理
                DateOfBirth:'',
                EntryDate:'',
                LeaveDate:'',
                //   新增人员    将 form表单改成自己的参数
                addFormVisible: false,
                form: {
                    "UserCode":'',
                    "UserName":'',
                    "IdentityCard":'',    //  身份证号
                    "NativePlace":'',     //  籍贯
                    "Educational":'',     //  学历
                    "ContactWay":'',      //  联系方式
//                    "RankDutyID":null,     //  职务职级
                    "Sex":null,         //  性别
                    "DateOfBirth":'',    //  生日
                    "Marry":null,           //  婚否
                    "CriticalContactWay":'',   //  紧急电话
                    "HomeAddress":'',     //  家庭住址
                    "EnteryMode":null,      //  入职方式
                    "UserStatus":null,      //  状态
                    "WageSettlementMode":null,   //  工资结算方式
                    "BasicWage":0,        //  基本工资
                    "EntryDate":'',       //  入职时间
                    "LeaveDate":'',       //  离职时间
                    "AwardPunish":'',     //  奖惩历史
                    "PhotoImg":'',         //  照片
                    "CertificageImg":'',   //  证书
                    "IdentityImg":''      //  身份证复印件
                },
                formLabelWidth: '100',
                //  修改人员  >>》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》
                //  工厂
                EditFactoryOptions:[],    //  工厂   一加载页面就出现工厂的下拉框
                valueFactoryEdit:'',    //  选择的是哪个工厂号
                //  部门
                EditParentOptions:[],     // 部门
                //   科室
                EditOfficeOptions:[],     // 科室
                //   职务职级
                EditDutyOptions:[],     // 职务职级
                //  工资
                SalaryEdit:{
                    BasicWageMin:0 ,
                    BasicWageMax:0 ,
                },
                EditFormVisible: false,
                formEdit:{
                    UserCode: '',      //   编辑的时候传一个员工号
                },
                formLabelWidthEdit:'100',

//                >》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》
                DateOfBirthEdit:'',    //
                EntryDateEdit:'',
                LeaveDateEdit:'',


                // 删除人员
                DeleteFormVisible: false,
                formDelete:{},
                formLabelWidthDelete:'100',
                // 授权
                PowerTable:[],
                multipleTable:[],
                formPower:{},
                PowerFormVisible: false,
                formLabelWidthPower:'100',
                multipleSelection: [] ,     //  checkbox
            }
        },
        methods:{
            //    分页
            handleSizeChange(val) {
                this.PageCount = val ;   //  每页几条
                this.selectTable();
            },
            handleCurrentChange(val) {
                this.CurrentPage = val ;   // 当前是第几页
                this.selectTable();     //  点击分页的时候
            },
            //   一加载页面就应该知道有哪些工厂
            GetFactory(){    // 校验输入信息正确性 ，不对直接  return
                let url = "http://192.168.3.238:8088/Department/GetFactoryInfo" ;
                this.$http.get(url,).then(response => {
                    this.FactoryOptions = [];
                    let Code = response.data.Code;
                    if(Code == 200){   // 正常请求到数据
                        this.FactoryOptions = response.data.ObjList ;
                    }
                }, response => {
                    console.log(" 工厂请求失败");
                    console.log(response)
                })
            },
            //  一选择工厂，就知道有哪些部门
            GetDepart(){
                let url = "http://192.168.3.238:8088/Department/GetParentDepartment?FactoryID=" + this.valueFactory ;
                this.$http.get(url,).then(response => {
                    let Code = response.data.Code;
                    console.log("隶属部门 ");
//                    console.log(response.data);
                    if(Code == 200){   // 正常请求到数据
                        this.DepartOptions = response.data.ObjList ;
                    }
                }, response => {
                    console.log(" 父级请求失败");
                    console.log(response)
                })
            },
            //  一选择部门，就知道有哪些科室
            GetOffice(){
                let url = "http://192.168.3.238:8088/OfficeManager/GetOfficeByPre?DepartID=" + this.valueDepart ;
                this.$http.get(url,).then(response => {
                    let Code = response.data.Code;
                    if(Code == 200){   // 正常请求到数据
                        this.OfficeOptions = response.data.ObjList ;
                    }
                }, response => {
                    console.log(" 请求失败");
                    console.log(response)
                })
            },
            //  查询的表格
            selectTable(){    // 校验输入信息正确性 ，不对直接  return
                let url = "http://192.168.3.238:8088/UserInfo/GetUserInfoPage?UserCode="+this.UserCode+"&UserName="+this.UserName+"&FactoryID="
                    +this.valueFactory+"&DepartCode="+this.valueDepart+"&OfficeCode="+this.valueOffice+"&UserStatus="+this.UserStatus+"&DateTimeStr="+ this.DateTimeStr
                    +"&PageCount="+this.PageCount+"&CurrentPage="+ this.CurrentPage;
                console.log("url是什么")
                console.log(url)
                this.$http.get(url,).then(response=>{
                    this.tableData = [] ;
                    let Code = response.data.Code;
                    if(Code == 200){   // 正常请求到数据
                        this.Total = response.data.Total;
                        for(let i=0;i<response.data.ObjList.length;i++){
                            this.tableData.push(response.data.ObjList[i]);
                            response.data.ObjList[i].index=i+1;
                        }
                    }
                console.log("人员 返回过来的 >>>>>>>>>>>>>>>>  ")
                console.log(response)
                }, response => {
                    console.log(" 表格添加失败")
                    console.log(response)
                })
            },
            //    新增的时候调用的获取工厂和部门的方法  》》》》》》》》》》》》》》》》》》》》》》》》》》》》》
            //   一点击新增就应该知道有哪些工厂
            selectFactoryAdd(){
                let url = "http://192.168.3.238:8088/Department/GetFactoryInfo" ;
                this.$http.get(url,).then(response => {
                    this.FactoryOptionsAdd = [];
                    let Code = response.data.Code;
                    if(Code == 200){   // 正常请求到数据
                        this.FactoryOptionsAdd = response.data.ObjList ;
                    }
                }, response => {
                    console.log(" 工厂请求失败");
                    console.log(response)
                })
            },
            //   新增里  一选择工厂的时候就应该获取父级下拉框
            selectParentAdd(){    // 校验输入信息正确性 ，不对直接  return     FactoryOptions
                if(this.valueFactoryAdd == 0){
                    console.log("请先选择工厂")
                }
                let url;
                url = "http://192.168.3.238:8088/Department/GetParentDepartment?FactoryID=" + this.valueFactoryAdd ;
                this.$http.get(url,).then(response => {
                    this.ParentOptionsAdd = [];
                    let Code = response.data.Code;
                    if(Code == 200){   // 正常请求到数据
                        this.ParentOptionsAdd = response.data.ObjList ;
                    }
                    console.log("父级下拉框成功");
                    console.log(response)
                }, response => {
                    console.log(" 父级请求失败");
                    console.log(response)
                })
            },
            //   科室  和  获取职务职级
            GetOfficeDuty(){
                let url = "http://192.168.3.238:8088/OfficeManager/GetOfficeByPre?DepartCode=" + this.valueParentAdd ;
                this.$http.get(url,).then(response => {
                    let Code = response.data.Code;
                    console.log("科室 》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》 ");
                    console.log(response.data);
                    if(Code == 200){   // 正常请求到数据
                        this.OfficeOptionsAdd = response.data.ObjList ;
                    }
                }, response => {
                    console.log("科室请求失败");
                    console.log(response)
                });
                //   职务职级
                let DutyUrl = "http://192.168.3.238:8088/RankDuty/GetAllRankDuty?DepartCode=" + this.valueParentAdd ;
                console.log(url)
                this.$http.get(DutyUrl,).then(response => {
                    let Code = response.data.Code;
                    console.log("职务职级 》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》 ");
                    console.log(response.data);
                    if(Code == 200){   // 正常请求到数据
                        this.DutyOptionsAdd = response.data.ObjList ;
                    }
                }, response => {
                    console.log(" 职务职级请求失败");
                    console.log(response)
                })
            },
            //  一选择职务职级   就把工资带出来
            GetSalary(){
                let url = "http://192.168.3.238:8088/RankDuty/GetAllRankDuty?RankDutyID=" + this.DutyAdd ;
                console.log(url)
                this.$http.get(url,).then(response => {
                    let Code = response.data.Code;
                    console.log("工资response 》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》 ");
                    console.log(response);
                    if(Code == 200){   // 正常请求到数据
                        this.Salary = response.data.ObjList[0] ;
                    }
                }, response => {
                    console.log(" 职务职级请求失败");
                    console.log(response)
                })
            },
            //   新增人员
            //  日期转换
            formatTen(num) {
                return num > 9 ? (num + "") : ("0" + num);
            } ,
            formatDate(date) {
                let year,month,day;
                year = date.getFullYear();
                month = date.getMonth() + 1;
                day = date.getDate();
                return year + "-" + this.formatTen(month) + "-" + this.formatTen(day);
            },
            add() {
                this.selectFactoryAdd();
                this.addFormVisible = true;
                console.log("我现在点击了新增按钮")
            },
            addForm(){
                console.log(this.form.DateOfBirth)
                console.log(this.form.EntryDate)
                console.log(this.form.LeaveDate)
                if(this.form.DateOfBirth.length != 0){
                    this.DateOfBirth = this.formatDate(this.form.DateOfBirth);
                }
                if(this.form.EntryDate.length != 0){
                    this.EntryDate = this.formatDate(this.form.EntryDate);
                }
                if(this.form.LeaveDate.length != 0){
                    this.LeaveDate = this.formatDate(this.form.LeaveDate);
                }
                console.log("date ")
                console.log(this.EntryDate)
                console.log(this.LeaveDate)
                console.log(this.DateOfBirth)
                //   post
                let addUrl = "http://192.168.3.238:8088/UserInfo/AddUserInfo";
                let addForm = {
                    "OperationUser": 1 ,   //  当前是谁操作的 新增功能
                    "UserCode":this.form.UserCode,
                    "UserName":this.form.UserName,
                    "IdentityCard":this.form.IdentityCard,    //  身份证号
                    "NativePlace":this.form.NativePlace,     //  籍贯
                    "Educational":this.form.Educational,     //  学历
                    "ContactWay":this.form.ContactWay,      //  联系方式
                    "RankDutyID":this.DutyAdd ,     //  职务职级
                    "DepartCode":this.valueParentAdd, //  部门
                    "OfficeCode":this.OfficeAdd ,      //  科室
                    "Sex":this.form.Sex,     //  性别
                    "DateOfBirth":this.DateOfBirth,    //  生日
                    "Marry":this.form.Marry,           //  婚否
                    "CriticalContactWay":this.form.CriticalContactWay,   //  紧急电话
                    "HomeAddress":this.form.HomeAddress,     //  家庭住址
                    "EnteryMode":this.form.EnteryMode,      //  入职方式
                    "WageSettlementMode":this.form.WageSettlementMode,   //  工资结算方式
                    "BasicWage":this.form.BasicWage,        //  基本工资
                    "AchievementBonus":this.Salary.AchievementBonus,   //  绩效奖金
                    "PostAllowance":this.Salary.PostAllowance,    //  岗位津贴
                    "PerfectAttendance":this.Salary.PerfectAttendance ,   //  全勤奖
                    "UserStatus":this.form.UserStatus,          //  状态
                    "EntryDate":this.EntryDate,       //  入职时间
                    "LeaveDate":this.LeaveDate,       //  离职时间
                    "AwardPunish":this.form.AwardPunish,     //  奖惩历史
                    "PhotoImg":this.form.PhotoImg,         //  照片
                    "CertificageImg":this.form.CertificageImg,   //  证书
                    "IdentityImg":this.form.IdentityImg      //  身份证复印件
                };
                console.log("addForm ")
                console.log(addForm)
                let that = this;
                if (this.form.UserName.length === 0 && this.form.UserCode.length) {   //  限制条件是什么
                    alert("员工姓名和工号不能为空");
                    return 0;
                } else {
                    this.$http.post(addUrl, addForm, {
                        headers: {
                            'Content-Type': 'application/x-www-form-urlencoded'
                        }
                    })
                        .then(function (response) {
                            that.addFormVisible = false;
                            that.selectTable();
                            console.log("添加成功");
                            console.log(response);
//                        需要提示
                        })
                        .catch(function (error) {
                            console.log(error);
                            console.log("错误");
                        });
                }
            },
            //   编辑修改人员   post  >》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》
            //  一点击编辑 ， 获取工厂下拉框
            SelectFactoryEdit(){
                let url = "http://192.168.3.238:8088/Department/GetFactoryInfo" ;
                this.$http.get(url,).then(response => {
                    this.EditFactoryOptions = [];
                    let Code = response.data.Code;
                    if(Code == 200){   // 正常请求到数据
                        this.EditFactoryOptions = response.data.ObjList ;
                    }
                    console.log("错误 ？？？？？？")
                    console.log(this.EditFactoryOptions)
                }, response => {
                    console.log(" 工厂请求失败");
                    console.log(response)
                })
            },
            // 一点开编辑，就获取该工厂下所有的部门下拉框
            selectParentEdit(){
                let url = "http://192.168.3.238:8088/Department/GetParentDepartment?FactoryID=" + this.formEdit.FactoryID ;
                console.log("编辑下拉框");
                this.$http.get(url,).then(response => {
                    let Code = response.data.Code;
                    if(Code == 200){   // 正常请求到数据
                        this.EditParentOptions = response.data.ObjList ;
                    }
                    console.log("修改的部门下拉框 》》》》》》》》》》》》》");
                    console.log(response.data)
                }, response=>{
                    console.log(" 修改的父级请求失败");
                    console.log(response)
                })
            },
            //  科室和职务
            GetOfficeDutyEdit(){
                let url = "http://192.168.3.238:8088/OfficeManager/GetOfficeByPre?DepartCode=" + this.formEdit.DepartCode ;
                this.$http.get(url,).then(response => {
                    let Code = response.data.Code;
                    console.log("科室 》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》 ");
                    console.log(response.data);
                    if(Code == 200){   // 正常请求到数据
                        this.EditOfficeOptions = response.data.ObjList ;
                    }
                }, response => {
                    console.log("科室请求失败");
                    console.log(response)
                });
                //   职务职级
                let DutyUrl = "http://192.168.3.238:8088/RankDuty/GetAllRankDuty?DepartCode=" + this.formEdit.DepartCode ;
                console.log(url)
                this.$http.get(DutyUrl,).then(response => {
                    let Code = response.data.Code;
                    if(Code == 200){   // 正常请求到数据
                        this.EditDutyOptions = response.data.ObjList ;
                    }
                    console.log("职务职级 》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》 ");
                    console.log(response.data);
                    console.log(this.EditDutyOptions);
                }, response => {
                    console.log(" 职务职级请求失败");
                    console.log(response)
                })
            },
            //  根据职务职级  获取固定工资范围
            GetSalaryEdit(){
                let url = "http://192.168.3.238:8088/RankDuty/GetRankDutyByID?RankDutyID=" + this.formEdit.RankDutyID ;
                console.log("职务职级获取工资》》》》》》》》》》")
                console.log(this.formEdit.RankDutyID)
                console.log(url)
                this.$http.get(url,).then(response => {
                    let Code = response.data.Code;
                    if(Code == 200){   // 正常请求到数据
                        if(response.data.ObjList.length == 0){
                            this.formEdit.BasicWageMin = 0;
                            this.formEdit.BasicWageMax = 0;
                        }else{
                            this.formEdit.BasicWageMin = response.data.ObjList[0].BasicWageMin ;
                            this.formEdit.BasicWageMax = response.data.ObjList[0].BasicWageMax ;
                        }
//                        this.SalaryEdit = response.data.ObjList[0] ;
                    }
                    console.log("工资response 》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》 ");
                    console.log(response.data.ObjList);
                }, response => {
                    console.log("职务职级获取工资");
                    console.log(response)
                })
            },
            //  修改 按钮
            handleEdit(index, row) {
                this.EditFormVisible = true;
                this.formEdit = row ;
                this.SelectFactoryEdit();
                this.selectParentEdit();
                this.GetOfficeDutyEdit();
                this.GetSalaryEdit();
                console.log("修改部门获取的全部字段 >>》》》》》》》》》》》");
                console.log(this.formEdit);
                //  部门号不能修改，只是作为参数传给后台
            },
            //   点击 修改的确定按钮
            EditForm() {    //   post
                console.log("千玺")
                console.log(this.formEdit.DateOfBirth)
                console.log(this.formEdit.EntryDate)
                console.log(this.formEdit.LeaveDate)
                if(this.formEdit.DateOfBirth == undefined){
                    this.formEdit.DateOfBirth = null
                }
                if(this.formEdit.EntryDate == undefined){
                    this.formEdit.EntryDate = null
                }
                if(this.formEdit.LeaveDate == undefined){
                    this.formEdit.LeaveDate = null
                }
//                console.log(this.formatDate(this.formEdit.DateOfBirth))
//                console.log(this.formatDate(this.formEdit.EntryDate))
//                console.log(this.formatDate(this.formEdit.LeaveDate))

//                if(this.formEdit.DateOfBirth.length != 0){
//                    this.DateOfBirthEdit = this.formatDate(this.formEdit.DateOfBirth);
//                }
//                if(this.formEdit.EntryDate.length != 0){
//                    this.EntryDateEdit = this.formatDate(this.formEdit.EntryDate);
//                }
//                if(this.formEdit.LeaveDate.length != 0){
//                    this.LeaveDateEdit = this.formatDate(this.formEdit.LeaveDate);
//                }
//                console.log("date ")
//                console.log(this.EntryDate)
//                console.log(this.LeaveDate)
//                console.log(this.DateOfBirth)
                let EditUrl = "http://192.168.3.238:8088/UserInfo/UpdateUserInfo";
                let EditForm = {
                    "UserCode":this.formEdit.UserCode,
                    "OperationUser": 1 ,   //  当前是谁操作的 新增功能
                    "UserName":this.formEdit.UserName,
                    "RankDutyID":this.formEdit.RankDutyID ,     //  职务职级
                    "DepartCode":this.formEdit.DepartCode , //  部门
                    "OfficeCode":this.formEdit.OfficeCode ,      //  科室
                    "Sex":this.formEdit.Sex,
                    "DateOfBirth":this.formEdit.DateOfBirth,    //  生日
                    "EntryDate":this.formEdit.EntryDate,       //  入职时间
                    "LeaveDate":this.formEdit.LeaveDate,       //  离职时间
                    "IdentityCard":this.formEdit.IdentityCard,    //  身份证号
                    "NativePlace":this.formEdit.NativePlace,     //  籍贯
                    "Educational":this.formEdit.Educational,     //  学历
                    "ContactWay":this.formEdit.ContactWay,      //  联系方式
                    "Marry":this.formEdit.Marry,           //  婚否
                    "CriticalContactWay":this.formEdit.CriticalContactWay,   //  紧急电话
                    "HomeAddress":this.formEdit.HomeAddress,     //  家庭住址
                    "EnteryMode":this.formEdit.EnteryMode,      //  入职方式
                    "WageSettlementMode":this.formEdit.WageSettlementMode,   //  工资结算方式
                    "BasicWage":this.formEdit.BasicWage,        //  基本工资
                    "AchievementBonus":this.formEdit.AchievementBonus,   //  绩效奖金
                    "PostAllowance":this.formEdit.PostAllowance,    //  岗位津贴
                    "PerfectAttendance":this.formEdit.PerfectAttendance ,   //  全勤奖
                    "UserStatus":this.formEdit.UserStatus,          //  状态
                    "AwardPunish":this.formEdit.AwardPunish,     //  奖惩历史
//                    "PhotoImg":this.formEdit.PhotoImg,         //  照片
                    "PhotoImg":'',         //  照片
//                    "CertificageImg":this.formEdit.CertificageImg,   //  证书
                    "CertificageImg":'',   //  证书
//                    "IdentityImg":this.formEdit.IdentityImg,      //  身份证复印件
                    "IdentityImg":'',      //  身份证复印件
                };
                console.log("修改人员的时候传的什么？？？？？？？？？？？");
                console.log(EditForm);
                console.log(EditUrl);
                let that = this ;
                this.$http.post(EditUrl, EditForm, {
                    headers: {
                        'Content-Type': 'application/x-www-form-urlencoded'
                    }
                })
                    .then(function (response) {
                        that.EditFormVisible = false;
                        that.selectTable();
                        console.log("修改成功");
                        console.log(response);
//                        需要提示
                    })
                    .catch(function (error) {
                        console.log("错误");
                        console.log(error);
                    });
            },
            //  删除人员
            handleDelete(index, row) {
                this.DeleteFormVisible = true ;
                this.formDelete = row ;
            },
            DeleteForm(){
                let DeleteUrl = "http://192.168.3.238:8088/UserInfo/DeleteUserInfo";
                let deleteItem = {   //  跟后端约定好的JSON格式
                    "UserCode":this.formDelete.UserCode,
                    "OperationUser":1,
                };
                console.log("删除人员？？？？？？？？")
                console.log(DeleteUrl)
                console.log(deleteItem)
                let that = this;  //   that管用吗   管用的，想自动刷新就在执行成功的方法里重新  searchTable 就行了
                this.$http.post(DeleteUrl, deleteItem, {
                    headers: {
                        'Content-Type': 'application/x-www-form-urlencoded'
                    }
                })
                    .then(function (response) {
                        console.log("删除成功>》》》》》》》》》》》》》》》》》》》》")
                        console.log(response)
                        that.DeleteFormVisible = false;     //  关闭窗口
                        that.selectTable();
//                        需要提示
                    })
                    .catch(function (error) {
                        console.log("错误");
                        console.log(error);
                    });
            },
            A(){
                if(this.formEdit.WageSettlementMode == 0){
                    this.formEdit.WageSettlementMode = null ;
                }
                if(this.formEdit.BasicWage == 0){
                    this.formEdit.BasicWage = null ;
                }
                if(this.formEdit.AchievementBonus == 0){
                    this.formEdit.AchievementBonus = null ;
                }
                if(this.formEdit.PostAllowance == 0){
                    this.formEdit.PostAllowance = null ;
                }
            },
            //  点击授权   按钮   弹框
            handleEmpower(index, row) {
                this.PowerFormVisible = true;
                this.formPower = row;
                //  获取表格中的数据
                this.PowerSelectTable();
                //  默认勾选
                console.log("PowerTable 是什么 >>>>>>>>>>>>  ");
                console.log(this.PowerTable)
                this.$refs.multipleTable.toggleRowSelection(this.PowerTable,true)
            },
            //  获取  授权表格
            PowerSelectTable(){    // 校验输入信息正确性 ，不对直接  return
                let url = "http://192.168.3.238:8088/UserInfo/GetUserRole?UserCode=" +this.formPower.UserCode ;
                this.$http.get(url,).then(response => {
                    let Code = response.data.Code;
                    if(Code == 200){   // 正常请求到数据
                        for(let i=0;i<response.data.ObjList.length;i++){
                            this.PowerTable.push(response.data.ObjList[i]);
                            response.data.ObjList[i].index=i+1;
                        }
                        console.log("授权 返回")
                    }
                }, response => {
                    console.log(" 表格添加失败")
                    console.log(response)
                })
            },
            //  这个是 授权 点击确定按钮时  把选中  复选框  传给后台
            handleSelectionChange(val) {
                this.multipleSelection = val;
                console.log("这是什么 复选框 集合 >>>>>>>>>>>>>>>>>> ")
                console.log(val)
            },
            //  点击 授权确定按钮
            PowerForm(){
                let PowerUrl = "http://192.168.3.238:8088/UserInfo/AddUserRole";
                let PowerItem = {   //  跟后端约定好的JSON格式
                    "UserCode":this.formPower.UserCode,
                    "RoleS":this.multipleSelection,
                    "CurrentUser":1,
                };
                console.log("授权")
                console.log(PowerUrl)
                console.log(PowerItem)
                let that = this;  //   that管用吗   管用的，想自动刷新就在执行成功的方法里重新  searchTable 就行了
                this.$http.post(PowerUrl, PowerItem, {
                    headers: {
                        'Content-Type': 'application/x-www-form-urlencoded'
                    }
                })
                    .then(function (response) {
                        console.log("授权成功")
                        that.PowerFormVisible = false;     //  关闭窗口
                        that.PowerSelectTable();
//                        需要提示
                    })
                    .catch(function (error) {
                        console.log("错误");
                        console.log(error);
                    });
            },
        },
        mounted:function(){   //  onload
            this.GetFactory();   // 请求到工厂的下拉框
            this.selectTable();    //  请求到表格
        }
    }
</script>

<style>
    * {
        padding: 0;
    }

    html,
    body {
        height: 100%;
        width: 100%;
        overflow: hidden;
        margin: 0;
    }

    #person {
        height: 100%;
    }
    /* 表头数据居中 */
    .table_person thead tr th {
        text-align: center;
    }

</style>